Skip to content

fix(app): process first CLI TUI input#280

Open
konard wants to merge 2 commits into
ProverCoderAI:mainfrom
konard:issue-274-1f6a9d48fe85
Open

fix(app): process first CLI TUI input#280
konard wants to merge 2 commits into
ProverCoderAI:mainfrom
konard:issue-274-1f6a9d48fe85

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented May 12, 2026

Summary

Fixes #274: the CLI TUI could appear ready while the first real user inputs were still ignored.

Root cause

A fresh menu snapshot started with inputStage: "cold" and skipInputs: 2. After the readiness/time gate had already finished, the Gridland input boundary could still consume two valid user key events, and the pure menu input handler also intentionally dropped the first single-character alias, arrow, or Enter event while moving from cold to active.

That violates the TUI liveness invariant: once the rendered menu is ready and not busy, a valid user key should be processed without requiring dummy keypresses.

Fix

  • Fresh CLI TUI snapshots now start with inputStage: "active" and skipInputs: 0.
  • The cold-stage input handler no longer drops semantic menu inputs; it activates and processes the first valid key in the same transition.
  • Existing post-interactive SSH/session handoff protection remains intact via restoreMenuAfterInteractiveEffect(... skipInputs: 2).
  • Removed the placeholder .gitkeep that was only used to bootstrap this PR branch.

Mathematical guarantees

  • Invariant: forall key in ValidMenuInput: ready(menu) and not busy(menu) and not sshActive(menu) -> processed(key).
  • CORE/SHELL boundary: bootstrap noise filtering remains in the Gridland shell gate (ready / ignoreUntil), while the pure input routing layer no longer discards valid domain events.
  • SOURCE: n/a.

Tests

  • bunx vitest run packages/app/tests/docker-git/menu-input-handler.test.ts
  • bun run --cwd packages/app lint:tests
  • bun run --cwd packages/app lint
  • bun run --cwd packages/app lint:effect
  • bun run --cwd packages/app typecheck
  • bun run check

Environment note: bun run --cwd packages/app test and full direct bunx vitest run were attempted locally, but this runner terminated them with SIGTERM before a Vitest assertion failure was emitted. The focused regression test and static/type checks above passed; CI should run the complete matrix on the pushed SHA.

konard added 2 commits May 12, 2026 09:49
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#274
@konard konard changed the title [WIP] Почему-то CLI TUI не работает fix(app): process first CLI TUI input May 12, 2026
@konard konard marked this pull request as ready for review May 12, 2026 10:22
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

Working session summary

Implemented and finalized PR #280: #280

Fixed the CLI TUI first-input bug by removing the cold-start swallow behavior and making fresh menu snapshots start with active input handling. Updated regression coverage in menu-input-handler.test.ts, with the implementation change in menu-input-handler.ts and menu-state.ts.

Verification:

  • Local targeted regression test passed.
  • Local lint, Effect lint, typecheck, and bun run check passed.
  • GitHub Actions for SHA 8090c62c62d62b1dd61aca06d2fecca146aefdc7 all passed: Check, Checking Dependencies, Snapshot.
  • PR is marked ready for review, merge state is CLEAN.
  • Working tree is clean.

SOURCE: n/a


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $20.312756

📊 Context and tokens usage:

  • 272.7K / 1.1M (26%) input tokens, 29.9K / 128K (23%) output tokens

Total: (272.7K + 16.2M cached) input tokens, 29.9K output tokens, $20.312756 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (44390KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Copy Markdown
Member

тут проблема была в том что он не загружал проекты хотя через browser версию всё работало

@skulidropek
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved menu input handling to process inputs more consistently upon activation
  • Tests
    • Updated test expectations for menu input and initialization behavior changes

Walkthrough

This PR fixes CLI TUI startup behavior by changing the menu initialization from "cold" to "active" state with skipInputs set to 0, and simplifying the input handler activation logic to always allow processing when menu input or action keys are detected.

Changes

Menu input flow

Layer / File(s) Summary
Menu state initialization contract
packages/app/src/docker-git/menu-state.ts
defaultMenuSnapshot() now initializes in "active" input stage with skipInputs: 0 (changed from "cold" with skipInputs: 2), with an issue-tracking comment documenting that the initial user key should be processed after readiness gates (issue-274).
Input activation simplification
packages/app/src/docker-git/menu-input-handler.ts
activateInput() logic was unified: it now returns { activated: true, allowProcessing: true } whenever menu input or action keys are present, removing prior conditional branches that withheld allowProcessing for certain inputs.
Test verification
packages/app/tests/docker-git/menu-input-handler.test.ts
Tests updated to expect runnerRunEffect and setSkipInputsMock invocation on cold-start input, and a new test verifies defaultMenuSnapshot() produces an "active" snapshot with skipInputs: 0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit hops through input gates,
No longer cold, now active waits—
First keys now flow, no skips remain,
The menu sings without refrain! 🎹✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: fixing the first CLI TUI input processing. It is concise, clear, and directly related to the changeset's primary purpose.
Description check ✅ Passed The description is comprehensive and well-structured, covering root cause, fix details, mathematical guarantees, and test verification. However, it deviates from the template by not explicitly filling the 'Source TZ / Issues' section headings in the exact format specified.
Linked Issues check ✅ Passed The PR addresses issue #274 by fixing the cold-start input swallowing behavior. Changes to menu-input-handler.ts and menu-state.ts ensure first valid user input is processed without dummy keypresses, directly resolving the reported CLI TUI malfunction.
Out of Scope Changes check ✅ Passed All code changes align with the stated objective of fixing first CLI TUI input processing. The placeholder .gitkeep removal is minor housekeeping directly tied to PR bootstrap. No unrelated changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/app/src/docker-git/menu-state.ts (1)

35-44: ⚡ Quick win

Normalize the traceability marker to QUOTE(ТЗ) (or n/a).

The new block uses QUOTE(ISSUE); the repo format requires QUOTE(ТЗ) for consistency.

Suggested patch
-// QUOTE(ISSUE): "Почему-то CLI TUI не работает"
+// QUOTE(ТЗ): "Почему-то CLI TUI не работает"

As per coding guidelines: “Functional comments must include: CHANGE, WHY, QUOTE(ТЗ) or n/a, REF, SOURCE or n/a, FORMAT THEOREM, PURITY (CORE|SHELL), EFFECT signature for SHELL functions, INVARIANT, and COMPLEXITY.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/app/src/docker-git/menu-state.ts` around lines 35 - 44, Replace the
traceability marker "QUOTE(ISSUE)" in the top comment block with the
repo-standard "QUOTE(ТЗ)" (or "n/a") so the block that starts with
CHANGE/WHY/QUOTE/... conforms to the required metadata format; locate the
comment containing "QUOTE(ISSUE)" in menu-state.ts and update only that token to
"QUOTE(ТЗ)" (or "n/a") ensuring all other tags (CHANGE, WHY, REF, SOURCE, FORMAT
THEOREM, PURITY, EFFECT, INVARIANT, COMPLEXITY) remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/app/src/docker-git/menu-state.ts`:
- Around line 35-44: Replace the traceability marker "QUOTE(ISSUE)" in the top
comment block with the repo-standard "QUOTE(ТЗ)" (or "n/a") so the block that
starts with CHANGE/WHY/QUOTE/... conforms to the required metadata format;
locate the comment containing "QUOTE(ISSUE)" in menu-state.ts and update only
that token to "QUOTE(ТЗ)" (or "n/a") ensuring all other tags (CHANGE, WHY, REF,
SOURCE, FORMAT THEOREM, PURITY, EFFECT, INVARIANT, COMPLEXITY) remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dee33db-6bd9-4220-a98b-982979ff7932

📥 Commits

Reviewing files that changed from the base of the PR and between 65c4f84 and 8090c62.

📒 Files selected for processing (3)
  • packages/app/src/docker-git/menu-input-handler.ts
  • packages/app/src/docker-git/menu-state.ts
  • packages/app/tests/docker-git/menu-input-handler.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Почему-то CLI TUI не работает

2 participants